package
{
	import com.thaiflashdev.utils.*;

	import flash.display.Sprite;
	import flash.events.Event;

	/**
	 * FileUtil examples
	 * @author katopz@sleepydesign.com
	 */
	public class FileUtilTest extends Sprite
	{
		public function FileUtilTest()
		{
			// case #1
			//FileUtil.openImageTo(this);

			// case #2 : browse image and trace
			//FileUtil.openImage(trace);

			// case #3 : browse jpg and listen
			//FileUtil.open(["*.jpg"], trace);

			// case #4 : browse jpg and listen
			FileUtil.open(["*.jpg"], eventHandler);
		}

		private function eventHandler(event:Event):void
		{
			if (event.type == Event.COMPLETE)
				addChild(LoaderUtil.loadBytes(event.target["data"]));
		}
	}
}